﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace App1
{
    class Player
    {
        private int _side;
        private Pawn[] _pawns = new Pawn[5];

        internal Pawn[] Pawns
        {
            get { return _pawns; }
            set { _pawns = value; }
        }
        private Guard[] _guards = new Guard[2];

        internal Guard[] Guards
        {
            get { return _guards; }
            set { _guards = value; }
        }
        private Elephant[] _elephants = new Elephant[2];

        internal Elephant[] Elephants
        {
            get { return _elephants; }
            set { _elephants = value; }
        }
        private Horse[] _horses = new Horse[2];

        internal Horse[] Horses
        {
            get { return _horses; }
            set { _horses = value; }
        }
        private Cannon[] _cannons = new Cannon[2];

        internal Cannon[] Cannons
        {
            get { return _cannons; }
            set { _cannons = value; }
        }
        private Rook[] _rooks = new Rook[2];

        internal Rook[] Rooks
        {
            get { return _rooks; }
            set { _rooks = value; }
        }
        private King _king = new King();

        internal King King
        {
            get { return _king; }
            set { _king = value; }
        }

        public Player(int side)
        {
            _pawns[0] = new Pawn();
            _pawns[1] = new Pawn();
            _pawns[2] = new Pawn();
            _pawns[3] = new Pawn();
            _pawns[4] = new Pawn();

            _guards[0] = new Guard();
            _guards[1] = new Guard();

            _elephants[0] = new Elephant();
            _elephants[1] = new Elephant();

            _horses[0] = new Horse();
            _horses[1] = new Horse();

            _cannons[0] = new Cannon();
            _cannons[1] = new Cannon();

            _rooks[0] = new Rook();
            _rooks[1] = new Rook();

            _king = new King();

            _side = side;

            if (side == 1)
            {
                _pawns[0].Init(3, 0, "Pawn0", 1, side, true, false);
                _pawns[1].Init(3, 2, "Pawn1", 1, side, true, false);
                _pawns[2].Init(3, 4, "Pawn2", 1, side, true, false);
                _pawns[3].Init(3, 6, "Pawn3", 1, side, true, false);
                _pawns[4].Init(3, 8, "Pawn4", 1, side, true, false);

                _guards[0].Init(0, 3, "Guard0", 2, side, true, false);
                _guards[1].Init(0, 5, "Guard1", 2, side, true, false);

                _elephants[0].Init(0, 2, "Elephant0", 3, side, true, false);
                _elephants[1].Init(0, 6, "Elephant1", 3, side, true, false);

                _horses[0].Init(0, 1, "Horse0", 4, side, true, false);
                _horses[1].Init(0, 7, "Horse1", 4, side, true, false);

                _cannons[0].Init(2, 1, "Cannon0", 5, side, true, false);
                _cannons[1].Init(2, 7, "Cannon1", 5, side, true, false);

                _rooks[0].Init(0, 0, "Rook0", 6, side, true, false);
                _rooks[1].Init(0, 8, "Rook1", 6, side, true, false);

                _king.Init(0, 4, "King", 7, side, true, false);
            }
            else
                if(side == 2)
                {
                    _pawns[0].Init(6, 0, "Pawn0", 1, side, true, true);
                    _pawns[1].Init(6, 2, "Pawn1", 1, side, true, true);
                    _pawns[2].Init(6, 4, "Pawn2", 1, side, true, true);
                    _pawns[3].Init(6, 6, "Pawn3", 1, side, true, true);
                    _pawns[4].Init(6, 8, "Pawn4", 1, side, true, true);

                    _guards[0].Init(9, 3, "Guard0", 2, side, true, true);
                    _guards[1].Init(9, 5, "Guard1", 2, side, true, true);

                    _elephants[0].Init(9, 2, "Elephant0", 3, side, true, true);
                    _elephants[1].Init(9, 6, "Elephant1", 3, side, true, true);

                    _horses[0].Init(9, 1, "Horse0", 4, side, true, true);
                    _horses[1].Init(9, 7, "Horse1", 4, side, true, true);

                    _cannons[0].Init(7, 1, "Cannon0", 5, side, true, true);
                    _cannons[1].Init(7, 7, "Cannon1", 5, side, true, true);

                    _rooks[0].Init(9, 0, "Rook0", 6, side, true, true);
                    _rooks[1].Init(9, 8, "Rook1", 6, side, true, true);

                    _king.Init(9, 4, "King", 7, side, true, true);
                }
        }
    }
}
